package com.bootdo.system.controller;

import com.bootdo.common.annotation.Log;
import com.bootdo.common.config.BootdoConfig;
import com.bootdo.common.controller.BaseController;
import com.bootdo.common.utils.FileUtil;
import com.bootdo.common.utils.R;
import com.bootdo.system.domain.DataBaseLogDO;
import com.bootdo.system.domain.SetDO;
import com.bootdo.system.domain.SystemSetDO;
import com.bootdo.system.service.ScanequipService;
import com.bootdo.system.service.SetService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.util.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.io.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

@RequestMapping("/sys/set")
@Controller
public class SetController extends BaseController {

    private String prefix="system/set"  ;

    @Autowired
    private ScanequipService scanequipService;

    @RequiresPermissions("sys:sysSet:sysSet")
    @GetMapping("")
    String sysSet(Model model) {
        //获取参数值
        SystemSetDO systemSetDO1 = scanequipService.getSystemSetDetail("scanCanuseDay");
        SystemSetDO systemSetDO2 = scanequipService.getSystemSetDetail("scandevicehour");
        SystemSetDO systemSetDO3 = scanequipService.getSystemSetDetail("scandevicetime");
        model.addAttribute("systemSetDO1",systemSetDO1);
        model.addAttribute("systemSetDO2",systemSetDO2);
        model.addAttribute("systemSetDO3",systemSetDO3);
        return prefix + "/sysSet";
    }

    /**
     * 修改
     */
    @ResponseBody
    @RequestMapping("/updateSet")
    public R updateSet(SystemSetDO systemSetDO) {
        scanequipService.updateSet(systemSetDO);
        return R.ok();
    }

}
